package com.sskj.api.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.time.LocalDateTime;

@Schema(description = "权限表")
@TableName("sys_permission")
@Data
public class Permission {

    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description = "主键ID")
    private Long id;

    @Schema(description = "名称")
    @NotBlank(message = "名称不能为空")
    private String name;

    @Schema(description = "父ID")
    @NotNull(message = "父节点不能为空")
    @TableField("p_id")
    private Long pid;

    @Schema(description = "图标")
    private String icon;

    @Schema(description = "地址路径")
    private String path;

    @Schema(description = "组件路径")
    private String component;

    @Schema(description = "类型[1:目录|2:菜单|3:按钮]")
    private String type;

    @Schema(description = "权限标识")
    private String action;

    @Schema(description = "排序")
    @TableField("sort_order")
    private Integer sortOrder;

    @Schema(description = "状态[0:禁用|1:启用]")
    private Integer status;

    @Schema(description = "是否显示[0:否|1:显示]")
    private Integer visible;

    @TableField("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @TableField("update_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
